File tree Expand file tree Collapse file tree 4 files changed +56
-2
lines changed
src/test/java/io/syslogic/agconnect Expand file tree Collapse file tree 4 files changed +56
-2
lines changed Original file line number Diff line number Diff line change 4747 mkdir build
4848 chmod +x ./gradlew
4949 PLUGIN_VERSION=$(cat ./gradle/libs.versions.toml | grep plugin_version | grep -Po '[\d.]+' | head -n1)
50- PACKAGE=https://maven.pkg.github.com/${{ env.GITHUB_ACTOR }}/${{ env.PLUGIN_NAME }}/${{ env.PLUGIN_NS }}/${{ env.PLUGIN_NAME }}/$PLUGIN_VERSION/${{ env.PLUGIN_NAME }}-$PLUGIN_VERSION.jar
50+ PACKAGE=https://maven.pkg.github.com/${{ env.GITHUB_ACTOR }}/${{ env.PLUGIN_NAME }}/${{ env.PLUGIN_NS }}/${{ env.PLUGIN_NAME }}/${ PLUGIN_VERSION} /${{ env.PLUGIN_NAME }}-${ PLUGIN_VERSION} .jar
5151 if wget --user ${{ env.GITHUB_ACTOR }} --password ${{ env.GITHUB_TOKEN }} -q --method=HEAD $PACKAGE; then
5252 echo "::notice::Version $PLUGIN_VERSION already published."
5353 echo "PUBLISHED=true" >> "$GITHUB_ENV"
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ configure<PublishingExtensionImpl> {
9292
9393This configuration is entirely optional, while providing the config file at the default location:
9494
95- ` distribution/agconnect_apiclient.json ` .
95+ - ` distribution/agconnect_apiclient.json ` .
9696
9797### Plugin Tasks
9898
Original file line number Diff line number Diff line change 1+ /repository.xcf
Original file line number Diff line number Diff line change 1+ package io .syslogic .agconnect ;
2+
3+ import org .gradle .testkit .runner .BuildResult ;
4+ import org .gradle .testkit .runner .GradleRunner ;
5+ import org .junit .jupiter .api .Assertions ;
6+ import org .junit .jupiter .api .BeforeEach ;
7+ import org .junit .jupiter .api .Test ;
8+
9+ import java .io .BufferedWriter ;
10+ import java .io .File ;
11+ import java .io .FileWriter ;
12+ import java .io .IOException ;
13+ import java .util .List ;
14+
15+ /**
16+ * AGConnect Publishing Test
17+ * @author Martin Zeitler
18+ */
19+ class PublishingTest {
20+
21+ GradleRunner runner ;
22+ List <String > buildArgs = List .of (":build" );
23+
24+ /**
25+ * Setting up {@link GradleRunner}, when running from directory `buildSrc`.
26+ * Eventually could also copy to @tmpDir and then inject the configuration.
27+ */
28+ @ BeforeEach
29+ public void setup () {
30+ if (new File ("" ).getAbsoluteFile ().getName ().equals ("buildSrc" )) {
31+ this .runner = GradleRunner .create ()
32+ .withProjectDir (new File ("../" ))
33+ .withPluginClasspath ()
34+ .withDebug (true )
35+ .forwardOutput ();
36+ } else {
37+ // This needs a Huawei Android project to test with.
38+ }
39+ }
40+
41+ @ Test
42+ public void testLibraryBuild () {
43+ BuildResult result = this .runner .withArguments (this .buildArgs ).build ();
44+ Assertions .assertNotNull (result );
45+ Assertions .assertTrue (result .getOutput ().contains ("BUILD SUCCESSFUL" ));
46+ }
47+
48+ private void writeFile (File destination , String content ) throws IOException {
49+ try (BufferedWriter output = new BufferedWriter (new FileWriter (destination ))) {
50+ output .write (content );
51+ }
52+ }
53+ }
You can’t perform that action at this time.
0 commit comments