-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from gradle/tt/fix-build-generator-on-windows
Fix generator and tests on Windows
- Loading branch information
Showing
14 changed files
with
61 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletions
14
...pe/unified-plugin/plugin-common/src/test/groovy/org/gradle/util/ResourceLoaderTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
package org.gradle.util | ||
|
||
import org.apache.commons.io.FileUtils | ||
|
||
import spock.lang.Specification | ||
|
||
import static org.gradle.test.util.TestAssertions.assertDirContainsExactly | ||
|
||
class ResourceLoaderTest extends Specification { | ||
private File outputDir = new File("output").tap { | ||
deleteDir() | ||
mkdirs() | ||
} | ||
|
||
def "can extract resource directory"() { | ||
given: | ||
File output = new File("output").tap { mkdirs() } | ||
ResourceLoader resourceLoader = new ResourceLoader() | ||
|
||
when: | ||
resourceLoader.extractDirectoryFromResources("templates/java-library", output) | ||
resourceLoader.extractDirectoryFromResources("templates/java-library", outputDir) | ||
|
||
then: | ||
FileUtils.listFiles(output, null, true)*.path.sort() == ['output/build.gradle.dcl', 'output/src/main/java/com/example/lib/Library.java'] | ||
assertDirContainsExactly(outputDir, ['build.gradle.dcl', 'src/main/java/com/example/lib/Library.java']) | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...d-plugin/plugin-common/src/testFixtures/groovy/org/gradle/test/util/TestAssertions.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.gradle.test.util | ||
|
||
import org.gradle.internal.impldep.org.apache.commons.io.FileUtils | ||
|
||
/** | ||
* Static util class containing test assertions. | ||
*/ | ||
class TestAssertions { | ||
private TestAssertions() { /* not instantiable */ } | ||
|
||
static void assertDirContainsExactly(File outputDir, List<String> expectedRelativePaths) { | ||
def actualPaths = FileUtils.listFiles(outputDir, null, true)*.path.sort() | ||
def expectedPaths = expectedRelativePaths.collect { new File(outputDir, it).path }.sort() | ||
assert actualPaths == expectedPaths | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters