Skip to content

Commit

Permalink
feat: allow for setting ESI client ID through Maven properties
Browse files Browse the repository at this point in the history
  • Loading branch information
coanghel committed Nov 26, 2024
1 parent d70ed93 commit 42b88d0
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 43 deletions.
63 changes: 63 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
<source>${project.build.sourceVersion}</source>
<target>${project.build.sourceVersion}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<excludes>
<exclude>net/nikr/eve/jeveasset/io/esi/EsiCallbackURL.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
Expand All @@ -96,6 +99,34 @@
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<executions>
<!-- Copy EsiCallbackURL to inject ESI client id -->
<execution>
<id>copy-and-filter-template</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/java</outputDirectory>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/EsiCallbackURL.java.template</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>java</nonFilteredFileExtension>
</nonFilteredFileExtensions>
<delimiters>
<delimiter>${*}</delimiter>
</delimiters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
Expand Down Expand Up @@ -180,6 +211,19 @@
<goal>run</goal>
</goals>
</execution>
<!-- Rename EsiCallbackURL from template -->
<execution>
<id>rename-template</id>
<phase>generate-sources</phase>
<configuration>
<target>
<move file="${project.build.directory}/generated-sources/java/net/nikr/eve/jeveasset/io/esi/EsiCallbackURL.java.template" tofile="${project.build.directory}/generated-sources/java/net/nikr/eve/jeveasset/io/esi/EsiCallbackURL.java" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
Expand All @@ -199,6 +243,25 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/java/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
/*
* Copyright 2009-2024 Contributors (see credits.txt)
*
* This file is part of jEveAssets.
*
* jEveAssets is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* jEveAssets is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with jEveAssets; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
package net.nikr.eve.jeveasset.io.esi;


public enum EsiCallbackURL {
LOCALHOST("http://localhost:2221", ""),
EVE_NIKR_NET("https://eve.nikr.net/jeveasset/auth", ""),
;
private final String url;
private final String a;

private EsiCallbackURL(String url, String a) {
this.url = url;
this.a = a;
}

public String getUrl() {
return url;
}

public String getA() {
return a;
}
}
/*
* Copyright 2009-2024 Contributors (see credits.txt)
*
* This file is part of jEveAssets.
*
* jEveAssets is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* jEveAssets is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with jEveAssets; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
package net.nikr.eve.jeveasset.io.esi;


public enum EsiCallbackURL {
LOCALHOST("http://localhost:2221", "${env.ESICLIENTID}"),
EVE_NIKR_NET("https://eve.nikr.net/jeveasset/auth", ""),
;
private final String url;
private final String a;

private EsiCallbackURL(String url, String a) {
this.url = url;
this.a = a;
}

public String getUrl() {
return url;
}

public String getA() {
return a;
}
}

0 comments on commit 42b88d0

Please sign in to comment.