Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move source sets #1939

Merged
merged 8 commits into from
Apr 10, 2018
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,4 @@ target/
*.ipr
*.iws
*.iml
/.gradle/
22 changes: 11 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,13 @@ allprojects {
// Also, build and use ManualTaglet as a taglet.
tasks.withType(Javadoc) {
dependsOn(':checker:shadowJar')
dependsOn(':javacutil:tagletClasses')
dependsOn(':util:tagletClasses')
doFirst {
options.encoding = 'UTF-8'
options.memberLevel = javadocMemberLevel
classpath += files(project(':checker').tasks.getByName('shadowJar').archivePath)
if (!project.name.toString().equals("javacutil")) {
options.taglets 'org.checkerframework.javacutil.dist.ManualTaglet'
options.tagletPath(project(':javacutil').sourceSets.taglet.output as File[])
}
options.taglets 'org.checkerframework.taglet.ManualTaglet'
options.tagletPath(project(':util').sourceSets.taglet.output as File[])
options.links = ['http://docs.oracle.com/javase/8/docs/api/', 'https://docs.oracle.com/javase/8/docs/jdk/api/javac/tree/']
// This file is looked for by Javadoc.
file("${destinationDir}/resources/fonts/").mkdirs()
Expand Down Expand Up @@ -139,12 +137,13 @@ def createCheckTypeTask(projectName, checker, shortName) {
project("${projectName}").tasks.create(name: "check${shortName}", type: JavaCompile, dependsOn: ':checker:shadowJar') {
description "Run the ${shortName} Checker on the main sources."
group 'Verification'
dependsOn ':jdk8:downloadJdk'
// Always run the task.
outputs.upToDateWhen { false }
source = project("${projectName}").sourceSets.main.java
classpath = project("${projectName}").compileJava.classpath
classpath = files(project("${projectName}").compileJava.classpath,project(':checker-qual').sourceSets.main.output)
destinationDir = file("${buildDir}")
dependsOn project(':checker-qual').tasks.jar

options.annotationProcessorPath = files(project(':checker').tasks.shadowJar.archivePath)
options.compilerArgs += [
'-processor', "${checker}",
Expand All @@ -166,8 +165,9 @@ def createCheckTypeTask(projectName, checker, shortName) {
*/
List<String> getJavaFilesToFormat(projectName) {
List<File> javaFiles = new ArrayList<>();
javaFiles.addAll(project(':' + projectName).sourceSets.main.java.files)
javaFiles.addAll(project(':' + projectName).sourceSets.test.java.files)
project(':' + projectName).sourceSets.forEach { set ->
javaFiles.addAll(set.java.files)
}
// Collect all java files in tests directory
fileTree("${project(projectName).projectDir}/tests").visit { details ->
if (!details.path.contains("nullness-javac-errors") && details.name.endsWith('java')) {
Expand Down Expand Up @@ -196,7 +196,7 @@ task htmlValidate(type: Exec) {
task allJavadoc(type: Javadoc, group: "Documentation") {
description = 'Generates a global API documentation for all the modules'
dependsOn(':checker:shadowJar')
dependsOn(':javacutil:tagletClasses')
dependsOn(':util:tagletClasses')
source(project(':checker').sourceSets.main.allJava, project(':framework').sourceSets.main.allJava,
project(':dataflow').sourceSets.main.allJava, project(':javacutil').sourceSets.main.allJava)

Expand Down Expand Up @@ -384,7 +384,7 @@ subprojects {
}

// Create a task for each JUnit test class whose name is the same as the JUnit class name.
sourceSets.test.allJava.filter { it.path.contains('s/src/tests') }.forEach { file ->
sourceSets.test.allJava.filter { it.path.contains('src/test/java/tests') }.forEach { file ->
String junitClassName = file.name.replaceAll(".java", "")
tasks.create(name: "${junitClassName}", type: Test) {
description "Run ${junitClassName} tests."
Expand Down
4 changes: 2 additions & 2 deletions checker-qual/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="bin/main" path="generated-src/main">
<classpathentry kind="src" output="bin/main" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
Expand All @@ -24,7 +24,7 @@
<attribute name="gradle_used_by_scope" value="test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/compatQual" path="generated-src/compat">
<classpathentry kind="src" output="bin/compatQual" path="src/compatQual/java">
<attributes>
<attribute name="gradle_scope" value="compatQual"/>
<attribute name="gradle_used_by_scope" value="compatQual"/>
Expand Down
2 changes: 1 addition & 1 deletion checker-qual/.project
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>checker-qual</name>
<comment>Project checker-qual created by Buildship.</comment>
<comment></comment>
<projects>
</projects>
<buildSpec>
Expand Down
24 changes: 7 additions & 17 deletions checker-qual/build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
sourceSets {
main {
java {
srcDirs = ['generated-src/main']
}
}

compatQual {
java {
srcDirs = ['generated-src/compat']
}
}
compatQual
}

task copySources(type: Copy) {
description 'Copy checker-qual source from other projects.'
includeEmptyDirs = false
doFirst {
// Delete the directory in case a previously copied file should no longer be in checker-qual
delete file('generated-src/main/')
delete file('src/main/java')
}

from files('../checker/src', '../dataflow/src', '../framework/src')
from files('../checker/src/main/java', '../dataflow/src/main/java', '../framework/src/main/java')
include "**/FormatUtil.java"
include "**/NullnessUtil.java"
include "**/RegexUtil.java"
Expand All @@ -35,7 +25,7 @@ task copySources(type: Copy) {
// Make files read only.
fileMode(0444)

into file('generated-src/main/')
into file('src/main/java')
}

compileJava {
Expand All @@ -47,15 +37,15 @@ task copyCompatQual(type: Copy) {
includeEmptyDirs = false
doFirst {
// Delete the directory in case a previously copied file should no longer be in checker-qual
delete file('generated-src/compat/')
delete file('src/compat/java')
}

from files('../checker/src', '../framework/src')
from files('../checker/src/main/java', '../framework/src/main/java')
include "**/compatqual/*.java"
// Make files read only.
fileMode(0444)

into file('generated-src/compat')
into file('src/compat/java')
}

compileCompatQualJava {
Expand Down
45 changes: 38 additions & 7 deletions checker/.classpath
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry combineaccessrules="false" kind="src" path="/framework"/>
<classpathentry kind="src" path="src"/>
<classpathentry excluding="testannotations/" kind="src" path="tests/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/framework/tests/junit-4.12.jar"/>
<classpathentry kind="lib" path="/framework/tests/hamcrest-core-1.3.jar"/>
<classpathentry kind="output" path="build"/>
<classpathentry kind="src" output="bin/main" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/java">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/resources">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/testannotations" path="src/testannotations/java">
<attributes>
<attribute name="gradle_scope" value="testannotations"/>
<attribute name="gradle_used_by_scope" value="test,testannotations"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/testannotations" path="src/testannotations/resources">
<attributes>
<attribute name="gradle_scope" value="testannotations"/>
<attribute name="gradle_used_by_scope" value="test,testannotations"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="src" path="/framework"/>
<classpathentry kind="src" path="/dataflow"/>
<classpathentry kind="src" path="/javacutil"/>
<classpathentry kind="src" path="/checker-qual"/>
<classpathentry kind="src" path="/util"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
6 changes: 6 additions & 0 deletions checker/.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
31 changes: 14 additions & 17 deletions checker/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
sourceSets {
main {
resources {
// Stub files, message.properties, etc.
srcDirs = ['src/main/java']
exclude '**/*.java'
}
}
testannotations
}

dependencies {
compile project(':framework')
compile project(':dataflow')
compile project(':javacutil')
compile project(':checker-qual')

testCompile group: 'junit', name: 'junit', version: '4.12'
}
testCompile project(':util')
testCompile sourceSets.testannotations.output

sourceSets {
main {
java {
srcDirs = ['src']
}
resources {
// Stub files, message.properties, etc.
srcDirs = ['src']
exclude '**/*.java'
}
}
test {
java {
srcDirs = ['tests/src', '../framework/src/org/checkerframework/framework/test']
}
}
testannotationsCompile project(':checker-qual')
}

jar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import org.checkerframework.framework.util.FlowExpressionParseUtil;
import org.checkerframework.framework.util.FlowExpressionParseUtil.FlowExpressionContext;
import org.checkerframework.framework.util.FlowExpressionParseUtil.FlowExpressionParseException;
import org.checkerframework.framework.util.PluginUtil;
import org.checkerframework.framework.util.dependenttypes.DependentTypesError;
import org.checkerframework.javacutil.AnnotationProvider;
import org.checkerframework.javacutil.PluginUtil;
import org.checkerframework.javacutil.TreeUtils;

/**
Expand Down
Loading